Skip to main content

View Controller

Integration of MobaiBiometric ViewController with complete UI

Initialization and calling present of MBCaptureSessionViewController

let viewController = MBCaptureSessionViewController(options: .init())
viewController.delegate = self
self.present(viewController, animated: true, completion: nil)

Delegate

MBCaptureSessionVCDelegate

onSuccess is executed for MBCaptureSession class when the capture session is successfully finished @param result contains a list of frames.

func onSuccess(result: MBCaptureSessionResult) { }

onFailure is executed for MBCaptureSessionService class when the camera can not be @param error describes whether there is a camera or face failure

func onFailure(error: MBCaptureSessionError) { }

onPresentedDismissTapped is executed when the user close the screen from the X button

func onPresentedDismissTapped() { }

Options

Inside the library, we have some options for changing the behaviour of capturing data:

Variable NameTypeDefault Value
autoCaptureEnabledbooleantrue
numberOfFramesBeforeCapturenumber10
numberOfFrameToCollectnumber5
frameIntervalnumber10
faceQualityEnabledbooleanfalse
timeBeforeAutomaticCapturenumber4
isDebuggingbooleanfalse
cameraPositionCameraPostion.front
presentedDismissButtonEnabledbooleanfalse
targetResolutionPadMBTargetResolution.hd1920x1080
previewScaleTypeMBPreviewScaleType.fill

Description

  • autoCaptureEnabled
    • tells whether the capture is automatic or manual:
      • Automatic: Automatically take an image with a specific time that you can configure with timeBeforeAutomaticCapture
      • Manual: Manually take an image with the help of a button that the library shows
  • numberOfFramesBeforeCapture
    • describes a number of the frame that the library capture before starting the process of capturing
  • numberOfFrameToCollect
    • describes the number of frames to collect during the capture session.
  • frameInterval
    • After collecting the first frame, is the number of frames to skip before collecting a frame.
  • faceQualityEnabled
    • to capture an image in a higher resolution
  • timeBeforeAutomaticCapture
    • number of seconds that the user needs to wait in automatic capture
  • isDebugging
    • it helps to check if constraints are working as expected
    • for the moment, we provide debug text for face
      • Too Far Away
      • Too Close
      • Too Far Up
      • Too Far Down
      • Too Far Left
      • No Face Found
      • Mouth Not Found
      • Valid Face
  • cameraPosition
    • option to select the side of the camera|
      • Front
      • Back
  • presentedDismissButtonEnabled
    • option to add or remove the dismiss button at the top (This works only with the ViewController approach)
  • targetResolutionPad
    • option to change the resolution of the camera
  • previewScaleType
    • Fill: Resize the video preview to fill the layer and keep the aspect ratio
    • Fit: Resize the video preview to fit inside the layer and keep the aspect ratio

If you have any questions, please contact .....